<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        class Dog{
            constructor(name, breed){
             this.name=name;
             this.breed=breed;
            }
            bark(){
                console.log(`Bark Bark My name is ${this.name}`);
            }
            cuddle(){
                console.log('I love you owner');
            }
            static info(){//不属于实例，属于类
                console.log('A dog is better than a cat by 10 times');
            }
            get descriptyion(){
                return ` ${this.name} is a ${this.breed} typeof of dog`;
            }
            set nickname(value){
                this.nick=value.trim();//去除空格
            }
            get nickname(){
                return this.nick;
            }
        }
       // console.log(Dog.info());
        var dahuang = new Dog('Sunny','Godlen Doodle');
       // console.log(dahuang.info());
        console.log(dahuang.descriptyion);
        dahuang.nickname = "大黄";
        console.log(dahuang.nickname);
    </script>
</body>
</html>